﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Example12.aspx.cs" Inherits="Chapter35.Example12" %>

<!DOCTYPE html>

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>代码清单 35-12 使用径向渐变</title>
    <meta name="author" content="Adam Freeman" />
    <meta name="description" content="A simple example" />
    <link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
    <style>
        canvas {
            border: thin solid black;
            margin: 4px;
        }
    </style>
</head>
<body>
    <canvas id="canvas" width="500" height="140">Your browser doesn't support the <code>canvas</code> element.</canvas>
    <script>
        var ctx = document.getElementById('canvas').getContext('2d');
        var grad = ctx.createRadialGradient(250, 70, 20, 200, 60, 100);
        grad.addColorStop(0, 'red');
        grad.addColorStop(.5, 'white');
        grad.addColorStop(1, 'black');
        ctx.fillStyle = grad;
        ctx.fillRect(0, 0, 500, 140);
    </script>
</body>
</html>
